<template>
    <transition>
        <div>
            <button @click="showQrcode()">showcode</button>
            <canvas id="canvas"></canvas>
        </div>

    </transition>
</template>
<script>
    import QRCode from 'qrcode';

    export default {
        name: 'modal',
        created() {
            this.showQrcode()
        },
        methods: {
            showQrcode: function () {
                var canvas = document.getElementById('canvas');
                QRCode.toCanvas(canvas, 'sample text', {
                    width: 200,
                    margin: 2
                }, function (error) {
                    if (error) console.error(error)
                    console.log('success!');
                })
            }
        }
    }
</script>
